/*
 * @Author: 高瑞寒 15932717091@163.com
 * @Date: 2022-05-07 00:07:39
 * @LastEditTime: 2022-05-07 00:14:38
 * @LastEditors: 高瑞寒 15932717091@163.com
 * @Description: 
 */
import React, { PureComponent } from 'react'

export default class Parent extends PureComponent {
  state = {
    count: 0
  }
  add = () => {
    this.setState({ count: this.state.count + 1 })
  }
  render() {
    console.log('render-parent');
    return (
      <div>
        <h1>当前值{this.state.count}</h1>
        <button onClick={this.add}>+1</button>
        <Child count={this.state.count}></Child>
      </div>
    )
  }
}

class Child extends PureComponent {
  render() {
    console.log('render-child');
    return (
      <h1>
        当前值:{this.props.count}
      </h1>
    )
  }
}
